/**
 * \file token.c
 **/

#include "token.h"

void r_tok_list_add(RVector* list, uint32_t type, void* extra)
{
  RToken token = {.type = type, .extra = extra };
  r_vector_append(list, &token);
}

RToken r_tok_list_get(RVector* list, uint32_t idx)
{
  RToken token;
  if (idx >= list->size){
    token.type = R_END_TOKEN;
  } else {
    r_vector_get_into(list, idx, &token);
  }
  return token;
}

void r_tok_list_init(RVector* vector)
{
  vector->el_size = sizeof(RToken);
  r_vector_init(vector);
}

